﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using SES.CMS.DO;
using SES.CMS.BL;

namespace SES.CMS.Module
{
    public partial class ucTinTuc : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
                loadTT();
        }
        public void loadTT()
        {
            DataTable dt = new cmsArticleBL().SelectHomepage();
            if (dt.Rows.Count > 0)
            {
                lbTit.Text = "<a href='/Article/" + dt.Rows[0].ItemArray [0].ToString() + "/"+ FriendlyUrl(dt.Rows[0].ItemArray[1].ToString())+ "'>" + dt.Rows[0].ItemArray [1].ToString() + "</a>";
                lbHA.Text = "<img src='/Media/" + dt.Rows[0].ItemArray[3].ToString() + "' width=\"132px\" />";
                lblTT.Text = dt.Rows[0].ItemArray[4].ToString();
                DataRow dr = dt.Rows[0];
                dt.Rows.Remove(dr);
                rpt.DataSource = dt;
                rpt.DataBind();
            }
        }
        protected string FriendlyUrl(string strTitle)
        {
            return Ultility.Change_AV(strTitle);
        }
    }
}